package com.smedi.ismedi.database.starter.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class BasicFieldEntity implements Serializable {
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Version
    @TableField(value = "version", fill = FieldFill.INSERT)
    private Integer version;

    @TableField(value = "created_user_id", fill = FieldFill.INSERT)
    private Long createdUserId;

    @TableField(value = "created_date", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private LocalDateTime createdDate;

    @TableField(value = "latest_updated_user_id", fill = FieldFill.INSERT_UPDATE)
    private Long latestUpdatedUserId;

    @TableField(value = "latest_updated_date", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    private LocalDateTime latestUpdatedDate;

    @TableLogic
    @TableField(value = "is_deleted", fill = FieldFill.INSERT)
    private boolean deleted;

    @TableField(value = "top_org_id")
    private String topOrgId;

    @TableField(value = "tenant_id")
    private String tenantId;
}
